<?php
/**
 * @copyright   Copyright (c) 2017 https://www.sapixx.com All rights reserved.
 * @license     Licensed (http://www.apache.org/licenses/LICENSE-2.0).
 * @author      pillar<ltmn@qq.com>
 * 店铺管理
 */
namespace app\allwin\validate;
use think\Validate;

class Store extends Validate{

    protected $rule = [
        'id'                => 'require|number',
        'member_miniapp_id' => 'require|number',
        'manage_uid'        => 'require|number',
        'mch_id'            => 'number',
        'charges'           => 'require|number|between:0,300',
        'cate_id'           => 'require|number',
        'cate_sid'          => 'require|number',
        'sort'              => 'require|number',
        'name'              => 'require',
        'address'           => 'require',
        'longitude'         => 'require',
        'latitude'          => 'require',
        'telphone'          => 'require',
        'tips'              => 'require',
        'img'               => 'require',
        'money_coupon'      => 'require|number|between:0,1000',
        'imgs'              => 'require|array',
    ];
    
    protected $message = [
        'id'                => '编辑ID',
        'member_miniapp_id' => '当前应用APP_ID',
        'manage_uid'        => '好店店长必须填写',
        'mch_id'            => '商户号必须是数字',
        'charges'           => '交易费比例必须填写,且0和300之间',
        'sort'              => '必须输入整数',
        'cate_id'           => '行业分类必须选择',
        'cate_sid'          => '二级分类必须选择',
        'name'              => '好店名称必须填写',
        'address'           => '地址必须填写',
        'longitude'         => '位置经度必须填写',
        'latitude'          => '位置纬度必须填写',
        'telphone'          => '联系电话必须填写',
        'tips'              => '广告语必须填写',
        'img'               => '默认图片必须填写',
        'imgs'              => '展示图片必须上传',
        'money_coupon'      => '消费满多少可领优惠券,0-1000元之间。',
    ];

    protected $scene = [
        'sort'       => ['id', 'sort'],
        'edit'       => ['id','member_miniapp_id', 'manage_uid', 'mch_id', 'cate_id', 'cate_sid', 'charges', 'name', 'address', 'longitude', 'latitude', 'telphone', 'tips', 'img', 'imgs'],
        'chain'      => ['store_id', 'title', 'address', 'longitude', 'latitude', 'telphone'],
        'wechatedit' => ['member_miniapp_id', 'manage_uid', 'charges', 'name', 'address', 'telphone', 'tags', 'img'],
        'apiedit'    => ['name', 'address', 'telphone', 'tips', 'money_coupon'],
        'reg'        => ['manage_uid','name','address','telphone','tips','money_coupon'],
    ];
}